<#include "../common/_layout.html"/>
<@layout>
<div class="ui-form ui-border-t">
    <form id="infoForm">
        <div class="ui-form-item ui-border-b">
            <label>标题 <font color="red">*</font></label>
            <input type="text" placeholder="标题 " name="info.title" value="${(info.title)!}" id="title">
            <input type="hidden" name="info.id" value="${(info.id)!}"/>
            <input type="hidden" name="info.type" value="5"/>
        </div>

        <div class="ui-form-item ui-form-item-textarea ui-border-b">
            <label>问题补充<font color="red">*</font></label>
            <textarea placeholder="问题补充" name="info.description" id="description">${(info.description)!}</textarea>
        </div>

       	 <div class="ui-btn-wrap">
                <input type="button" class="ui-btn-lg ui-btn-primary" id="savebtn" onclick="save();" value="发布"/>
         </div>
    </form>
</div>

<script type="text/javascript">
	function save(){
		if(!$("#title").val()){
			tips("请填写标题");
			return false;
		}
		if(!$("#description").val()){
			tips("请完善问题补充");
			return false;
		}
		
		$.ajax({
	         type: "post",
	         url: "info/save",
	         data:$("#infoForm").serialize(),// 要提交的表单 
	         success:function(data){
	        	  var msg = data.msg;
		          if(data.code==200){
		        	  msg = "发布成功";
		              setTimeout(function(){window.location.href='/my';},1000);
		          }
		          
		          $.tips({
		  				content:msg,
		  				stayTime:1000,
		  				type:"info"
		  			});
		       }
	    });
	}
</script>
</@layout>